from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static

from drf_spectacular.views import SpectacularAPIView,SpectacularSwaggerView,SpectacularRedocView
from drf_spectacular.utils import extend_schema

import os

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/v1/', include('users.urls')),
    path('api/v1/', include('trend.urls')),
    path('api/v1/', include('phase_summary.urls')),
    path('api/v1/', include('industry_report.urls')),
    path('api/v1/graphNeo4j/', include('graphNeo4j.urls')),
    path('doc/schema/', SpectacularAPIView.as_view(), name='schema'),
    path('doc/swagger/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
    path('doc/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
    path('api/v1/', include('graph.urls')),
    path('api/v1/', include('tech_insight.urls')),

] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

# 开发环境下提供静态文件服务
if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
    # 添加trend/output目录的静态文件服务
    urlpatterns += static('/static/trend/output/', document_root=os.path.join(settings.BASE_DIR, 'trend/output')) 



